package com.one.blocks.mvc.enums;

import com.one.blocks.common.enums.CodeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author linfuxin Created on 2022-02-14 10:39:05
 */
@Getter
@AllArgsConstructor
public enum BatchResultEnum implements CodeEnum {

    /**
     * 失败
     */
    FAILED(0),

    /**
     * 部分成功
     */
    PART_SUCCESS(1),

    /**
     * 全部成功
     */
    SUCCESS(2),
    ;

    private final int code;

    public static BatchResultEnum getInstance(int code) {
        for (BatchResultEnum value : values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }
}
